<template>
  <a-modal
    :width="1000"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-descriptions :title="formInfo.title">

      <a-descriptions-item label="姓名">{{ formInfo.name }}</a-descriptions-item>
      <a-descriptions-item label="性别">{{ formInfo.sex }}</a-descriptions-item>
      <a-descriptions-item label="年龄">{{ formInfo.age }}岁</a-descriptions-item>
      <a-descriptions-item label="身份证号">{{ formInfo.identityCode }}</a-descriptions-item>
      <a-descriptions-item label="就诊卡号">{{ formInfo.cardNo }}</a-descriptions-item>
      <a-descriptions-item label="联系电话">{{ formInfo.mobile }}</a-descriptions-item>
      <a-descriptions-item label="状态">{{ formInfo.state==2?'已完成':'' }}</a-descriptions-item>
      <a-descriptions-item label="开始时间">{{ formInfo.startdate }}</a-descriptions-item>
      <a-descriptions-item label="结束时间">{{ formInfo.enddate }}</a-descriptions-item>
      <a-descriptions-item label="试卷">{{ formInfo.wjid }}</a-descriptions-item>
      <a-descriptions-item label="得分">{{ formInfo.score }}</a-descriptions-item>
    </a-descriptions>
    <a-card style="margin-top: 10px" >
      <a-row v-for="it in this.qlist" style="border: 1px solid rgba(236,236,236,0.37);">
        <a-col :span="2" v-if="it.parendid==0">
          {{it.itemNum}}
          <span v-if="it.selectType ==1">(单选)</span>
          <span v-if="it.selectType ==2">多选</span>
        </a-col>
        <a-col :span="13" v-if="it.parendid==0">
            {{it.itemName}}
        </a-col>
        <a-col :span="6" v-if="it.parendid==0">
          <a-row v-for="its in it.mapTemp.clist">
            <a-col :span="24" >
              <a-input v-model="its.parendid" style="width: 10%;height: 11px;" type="radio" v-if="it.selectType ==1" :checked="its.ischeck==1?true:false"/>
              <a-input v-model="its.parendid"  style="width: 10%;height: 11px;" type="checkbox" v-if="it.selectType ==2" :checked="its.ischeck==1?true:false"/>
              <span v-if="it.selectType ==1||it.selectType ==2">{{its.itemName}}({{its.sorce}}分)</span>
              <span v-if="it.selectType ==3">{{its.ischeck}}</span>
            </a-col>
          </a-row>
        </a-col>
      </a-row>


    </a-card>
  </a-modal>
</template>

<script>
  import pick from 'lodash.pick'
  import { getAction } from '@/api/manage'

  export default {
    name: 'EvaResultView',
    components: {},
    data () {
      return {
        visible: false,
        confirmLoading: false,
        formInfo: {},
          dlist:[],
          qlist:[],
        url: {
          saveInfo: '/system/evaResult/save',
          getInfo: '/system/evaResult/info'
        }
      }
    },
    created () {
    },
    methods: {
      show (record) {
        this.formInfo = Object.assign({}, record)
        if (this.formInfo.id) {
          getAction(this.url.getInfo, { 'id': record.id }).then(res => {
            this.$nextTick(() => {
              this.formInfo = (pick(res.result.data
        , 'id'
        , 'user'
        , 'name'
        , 'sex'
        , 'mobile'
        , 'state'
        , 'startdate'
        , 'enddate'
        , 'wjid'
        , 'score'
        , 'identityCode'
        , 'cardNo'
                  ,'age'
              ))
                console.log(res)
                this.dlist = res.result.dlist
                this.qlist = res.result.qlist
            })
          })
        }
        this.visible = true
      },
                                                                                                                                      // 确定
      handleSubmit () {
        this.visible = false
      },
      // 关闭
      handleCancel () {
        this.close()
      },
      close () {
          this.qlist=[]
        this.visible = false
      }
    }
  }
</script>
